WIFI STA AND AP BRIDGING INTRODUCTION


1. Configuration Modification

Use nand to configure:

Compile:

0:make infinity2m_spinand_ssc011a_s01a_minigui_defconfig
make menuconfig
1:
Networking support -> Wireless:
<*> cfg80211 - wireless configuration API
2:
Device Drivers->Generic Driver options
[*] Support for uevent helper
3:
Networking support → Networking options
<M> 802.1d Ethernet Bridging

Generate image, and generate llc.ko, stp.ko, and bridge.ko under kernel/modules as the bridge driver. Copy to \project\release\nvr\i2m\common\glibc\8.2.1\wifi\configs for convenience, and packaged to the board.

Then compile project and update.


2. Board Modification

0: modify /appconfigs/wpa_supplicant.conf, and add the information of AP,
/ # vi appconfigs/wpa_supplicant.conf
ctrl_interface=/tmp/wifi/run/wpa_supplicant
update_config=1

network={
    ssid="aryl iPhone"
    psk="123456789a"
}
  1. Load the driver

    cd /config/wifi
    
    insmod llc.ko
    insmod stp.ko
    insmod bridge.ko
    
  2. Add a configuration to hostapd.conf

    bridge=br0
    
  3. Add environment variables

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/lib:/config/wifi
    
  4. Initialize wifi

    ./ssw01bInit.sh
    
  5. Establish network adaptor bridging

    ifconfig wlan0 up
    ifconfig p2p0 up
    ifconfig wlan0 0.0.0.0
    ifconfig p2p0 0.0.0.0
    brctl addbr br0
    brctl addif br0 wlan0
    brctl addif br0 p2p0
    ifconfig br0 up
    
  6. Connect wifi to sta

    ./wpa_supplicant -Dnl80211 -i wlan0 -c /appconfigs/wpa_supplicant.conf -b br0 &
    udhcpc -S /etc/init.d/udhcpc.script -i br0
    
  7. Open AP mode

    ./hostapd -B /config/wifi/hostapd.conf
    ./dnsmasq -i p2p0 --no-daemon -C /config/wifi/dnsmasq.conf &
    

AP:

SSID: ssw101bap

pwd: 12345678

If sta connect to WAN successfully, it can also link network normally when pc connected to ssw101bap.